package cn.bytecollege.user.service;

import cn.bytecollege.common.entity.User;
import cn.bytecollege.user.dao.UserDao;

public class UserService {
    UserDao userDao = null;
    public UserService(){
        userDao = new UserDao();
    }
    /**
     * 根据用户名查询用户
     */
    public User findUserByUsername(String username){
        return  userDao.findUserByUsername(username);
    }

    /**
     * 注册用户
     */
    public int save(User user){
        return userDao.userSave(user);
    }
    /**
     * 更新用户
     */
    public int update(User user){
        return  userDao.updateUser(user);
    }

    /**
     * 根据userId查询user
     * @param userId
     * @return
     */
    public User findUserByUserId(Integer userId){
        return userDao.findUserByUserId(userId);
    }

    /**
     * 根据id修改用户信息
     * @param user
     * @return
     */
    public int userUpdateById(User user){
        return userDao.userUpdateById(user);
    }
}
